classdef DensityCrosser
    %UNTITLED4 Summary of this class goes here
    %   Detailed explanation goes here
    
    properties
    end
    
    methods
        function children = execute(~, obj, parents)
            child1 = obj.IndividualsClass.new(); %have to add .new static function to Individual implementation
            child2 = obj.IndividualsClass.new();
       
            
            parent1_density = sum(sum(parents(1).connections))/(obj.stops.number^2-obj.stops.number);
            parent2_density = sum(sum(parents(2).connections))/(obj.stops.number^2-obj.stops.number);
            
            density = (parent1_density+parent2_density)/2;
            
            child1.connections = random_connections( obj.stops.number, density );           
            child2.connections = random_connections( obj.stops.number, density );
            children = [child1, child2];
        end
    end
    
end

